<?php
/*
 **************************************************************************************************
 *	The template for displaying comments
 *
 *	The area of the page that contains comments and the comment form
 **************************************************************************************************
*/
// prevent the direct loading of this file
if ( ! empty( $_SERVER['SCRIPT_FILENAME'] ) && basename( $_SERVER['SCRIPT_FILENAME'] ) == 'comments.php' )
	wp_die( __( 'You can not access this file directly,', TEXTDOMAIN ) );

// the current post is protected by a password
if ( post_password_required() )
	return;
?>

<div id="comments" class="comment-area"><!-- must use id="comments" -->
	<?php if ( have_comments() ) : ?>
		<h4>
		<?php
			printf(
				_nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', TEXTDOMAIN ),
				number_format_i18n( get_comments_number() ),
				get_the_title()
			);
		?>
		</h4>
		<!-- list comments for a particular post -->
		<?php wp_list_comments( array( 'callback' => 'prototype_comments_callback' ) ); ?>
		<!-- comments to navigate -->
		<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
			<nav class="navigation comment-navigation" role="navigation">
				<div class="nav-previous">
					<?php previous_comments_link( __( '&larr; Older Comments', TEXTDOMAIN ) ); ?>
				</div>
				<div class="nav-next">
					<?php next_comments_link( __( 'Newer Comments &rarr;', TEXTDOMAIN ) ); ?>
				</div>
			</nav>
		<?php endif; ?>
		<!-- comments is disabled -->
		<?php if ( ! comments_open() && get_comments_number() ) : ?>
			<p class="no-comments"><?php _e( 'Comments are Closed' , TEXTDOMAIN ); ?></p>
		<?php endif; ?>

	<?php endif; ?>

	<!-- outputs comment form -->
	<?php comment_form(); ?>
</div>
